package wiinf;

/**
 *
 * @author David Roos
 */
public class afdToevoegen extends javax.swing.JPanel {
   private serverViewModel model;
   

    /**
     * Aanmaken nieuwe panel voor afdeling toevoegen
     *
     * @param model De JFrame waar de panel in komt
     */
    public afdToevoegen(serverViewModel model) {
        initComponents();
        this.model = model;
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        TafdNaam = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        BafdOpslaan = new javax.swing.JButton();

        setPreferredSize(new java.awt.Dimension(435, 303));

        jLabel1.setText("Naam:");

        BafdOpslaan.setText("Opslaan");
        BafdOpslaan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BafdOpslaanActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(246, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(TafdNaam, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(BafdOpslaan, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TafdNaam, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 238, Short.MAX_VALUE)
                .addComponent(BafdOpslaan)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Action listener voor de opslaan button
     *
     * @param evt action event
     */
    private void BafdOpslaanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BafdOpslaanActionPerformed
        // TODO add your handling code here:
        String naam = TafdNaam.getText();
        model.server.setAfdeling(naam);
        TafdNaam.setText("");
    }//GEN-LAST:event_BafdOpslaanActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BafdOpslaan;
    private javax.swing.JTextField TafdNaam;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}
